package cn.bigcontainer.alt.calendar.dto;

import cn.bigcontainer.alt.common.util.WoDateKit;
import cn.bigcontainer.alt.common.util.WoKit;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * @author jiaod
 *
 */
@Slf4j
@Data
public class MCalendarEvent {

	private String id;
	
	private String title;
	
	private String color;
	
	private String start;
	
	private String end;
	
	private String app;
	
	private String subapp;

	private Double minutes;
	
	/**
	 * 创建人姓名
	 */
	private String cjrXm;
	
	/**
	 * 状态
	 */
	private String status;
	
	/**
	 * @return
	 */
	public Boolean getEditable () {
		String dateStr = end;
		if (WoKit.isEmpty(dateStr)) {
			dateStr = start.split(" ")[0] + " 23:59:59";
		}
		if (WoDateKit.getNow().compareTo(dateStr) < 0) {
			return true;
		}
		return false;
	}
	
	/**
	 * @return
	 */
	public Boolean getStartEditable () {
		return getEditable();
	}
	
	/**
	 * @return
	 */
	public Boolean getDurationEditable () {
		return getEditable();
	}
	
	/**
	 * @return
	 */
	public Boolean getAllDay () {
		return WoDateKit.isDate(start);
	}
}
